﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for UrlBuilder
/// </summary>
public class UrlBuilder
{
    public UrlBuilder()
    {
        //
        // TODO: Add constructor logic here
        //
    }
    public static string RootUrl
    {
        get
        {
            if (HttpContext.Current.Request.ServerVariables["SERVER_PORT"] == "80")
                return "http://" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"];
            else
                return "http://" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + ":" + HttpContext.Current.Request.ServerVariables["SERVER_PORT"];
        }
    }
    public static string ImageUrl(string Source, int width, int? height)
    {
        if (Source.Equals(string.Empty))
            if (height.HasValue)
                return "/img/imagenull.jpg" + "?w=" + width + "&h=" + height.Value;
            else
                return "/img/imagenull.jpg" + "?w=" + width;
        if (height.HasValue)
        {
            return Source + "?w=" + width + "&h=" + height.Value;
        }
        return Source + "?w=" + width + "&c=1";

    }

    public static string UrlListNews(string CategoryTextId)
    {
        return "/tin-tuc/" + CategoryTextId + ".html";
    }
    public static string UrlListNewsPaging(string CategoryTextId)
    {
        return "/tin-tuc/" + CategoryTextId + "/trang-{0}.html";
    }
    public static string UrlNewsDetail(string CategoryTextId, string NewsTextId)
    {
        return "/tin-tuc/" + CategoryTextId + "/" + NewsTextId + ".html";
    }
    public static string UrlAlbumList(string AlbumTextId)
    {
        return "/hinh-anh/" + AlbumTextId + ".html";
    }
    public static string UrlAlbumPaging(string AlbumTextId)
    {
        return "/hinh-anh/" + AlbumTextId + "/trang-{0}.html";
    }
   
    public static string UrlVideoList(string VideoCategoryTextId)
    {
        return "/video/" + VideoCategoryTextId + ".html";
    }
    public static string UrlVideoListPaging(string VideoCategoryTextId)
    {
        return "/video/" + VideoCategoryTextId + "/trang-{0}.html";
    }
    public static string UrlVideoPlayer(string VideoCategoryTextId, string VideoTextId)
    {
        return "/video/" + VideoCategoryTextId + "/" + VideoTextId + ".html";
    }
    public static string UrlVideoHome()
    {
        return "/video.html";
    }

}
